#!/usr/bin/env python
"""
# -*- coding: utf-8 -*-
# @Time    : 2020/9/26 15:53
# @Author  : AshJo
# @Desc    : 魔术方法
# @Filename: Magic_methods.py
# @Version : v1.0
"""


class A:
    def __call__(self, *args, **kwargs):
        print('-' * 11)


class B:
    def __init__(self, name):
        self.name = name
        self.lst = []

    def __len__(self):
        return len(self.lst)


class Course:
    def __init__(self, name, price, period):
        self.name = name
        self.price = price
        self.period = period

    def __str__(self):
        return ','.join([self.name, str(self.price), str(self.period)])


python = Course('python', 21910, 6)
linux = Course('linux', 19800, 5)
go = Course('golang', 18099, 6)
lst = [python, linux, go]
for coure in lst:
    print(coure)

obj = A()
print(callable(obj))
obj()
A()()

obj = B('fruit')
obj.lst.append('apple')
obj.lst.append('orange')
print(len(obj))
